package com.rightsidetech.system.dtos.request.news;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

@Data
public class FileUriType implements Serializable {

    @ApiModelProperty(value = "类型: 1图片 2视频",required = true)
    @Range(min = 1,max = 2,message = "新闻只允许上传图片和视频")
    @NotNull(message = "文件类型不可为空")
    private Byte type;

    @ApiModelProperty("文件url")
    @NotBlank(message = "文件不能为空")
    @Pattern(regexp = "^http://.*|https://.*",message = "文件参数格式错误")
    @Length(max = 255,message = "文件长度过长")
    private String url;
}
